/**
 * FriendServiceImpl.java
 */
package com.tobeface.sns.application.pal.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.kissme.core.orm.Page;
import com.tobeface.sns.application.pal.FriendService;
import com.tobeface.sns.domain.User;
import com.tobeface.sns.infrastructure.persist.pal.FriendRepository;

/**
 * @author Dylan
 * @time 2012-7-28
 */
@Service
public class FriendServiceImpl implements FriendService {

	@Resource
	private FriendRepository repository;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.sinzv.sns.application.pal.FriendService#findByAddress(com.sinzv.sns
	 * .domain.User)
	 */
	public Page<User> findByAddress(Page<User> page,User self) {
		return repository.findByAddress(page,self);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.sinzv.sns.application.pal.FriendService#findByVocation(com.sinzv.
	 * sns.domain.User)
	 */
	public Page<User> findByVocation(Page<User> page,User self) {
		return repository.findByVocation(page,self);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.sinzv.sns.application.pal.FriendService#findOne(java.lang.String)
	 */
	public User findOne(String id) {
		return repository.findOne(id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.sinzv.sns.application.pal.FriendService#findByName(java.lang.String)
	 */
	public Page<User> findByName(Page<User> page,String name) {
		return repository.findByName(page,name);
	}

	/* (non-Javadoc)
	 * @see com.sinzv.sns.application.pal.FriendService#makeFriend(com.sinzv.sns.domain.User, com.sinzv.sns.domain.User)
	 */
	@Override
	public void makeFriend(User self, User friend) {
		repository.makeFriend(self, friend);
	}

	/* (non-Javadoc)
	 * @see com.tobeface.sns.application.pal.FriendService#breakFriend(com.tobeface.sns.domain.User, com.tobeface.sns.domain.User)
	 */
	@Override
	public void breakFriend(User self, User friend) {
		repository.breakFriend(self, friend);
	}

}
